﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <meta charset="utf-8" />
    <script src="Scripts/jquery-1.7.1.js"></script>
</head>
<body>
    数据处理中，请稍候……
</body>
</html>
<script>
    $(function () {
        if ($.trim(GetQueryString("code")) && $.trim(GetQueryString("state"))) {
            var code = GetQueryString("code");
            var state = GetQueryString("state");
            $.ajax({
                type: 'post',
                async: false,
                url: '/account/thirdlogin',
                dataType: 'json',
                data: { code: code, state: state },
                success: function (o) {
                    if (o.State == 1) {
                        window.opener.location.href = o.Url;
                    } else {
                        alert("第三方登录出错："+o.Message);
                    }
                }, error: function (xm, sta, e) {
                    alert('ThirdLogin RequestError：' + e.toString());
                }
            });
        }
        window.close();
    });

    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]); return null;
    }
</script>